{% load debate_tags i18n %}

<!-- TAB RELEASES -->
{% if pref.team_tab_released %}
  <li class="nav-item {% if tab_team_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'standings-public-tab-team' %}">{% trans "Team Tab" %}</a>
  </li>
{% endif %}
{% if pref.break_category_tabs_released %}
  {% for category in tournament.break_categories_nongeneral %}
    <li>
      <a class="nav-link" href="{% tournamenturl 'standings-public-tab-break-category' category=category.slug %}">
        {% blocktrans trimmed with category=category.name %}
          {{ category }} Teams
        {% endblocktrans %}
      </a>
    </li>
  {% endfor %}
{% endif %}
{% if pref.speaker_tab_released %}
  <li class="nav-item {% if tab_speaker_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'standings-public-tab-speaker' %}">{% trans "Speaker Tab" %}</a>
  </li>
{% endif %}
{% if pref.speaker_category_tabs_released %}
  {% for category in tournament.speakercategory_set.all %}
    {% if category.public %}
      <li>
        <a class="nav-link" href="{% tournamenturl 'standings-public-tab-speaker-category' category=category.slug %}">
          {% blocktrans trimmed with category=category.name %}
            {{ category }} Speakers
          {% endblocktrans %}
        </a>
      </li>
    {% endif %}
  {% endfor %}
{% endif %}
{% if pref.replies_tab_released %}
  <li class="nav-item {% if tab_replies_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'standings-public-tab-replies' %}">{% trans "Replies Tab" %}</a>
  </li>
{% endif %}
{% if pref.adjudicators_tab_released %}
  <li class="nav-item {% if adjudicators_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'standings-public-adjudicators-tab' %}">{% trans "Adjudicator Tab" %}</a>
  </li>
{% endif %}
{% if pref.motion_tab_released %}
  {% if pref.enable_motion_reuse %}
    <li class="nav-item dropdown {% if motions_nav %}active{% endif %}">
      <a class="nav-link dropdown-toggle" href="#" id="motionsDrop"
         data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        {% trans "Motions Tab" %}
      </a>
      <div class="dropdown-menu" aria-labelledby="motionsDrop">
        <a class="dropdown-item" href="{% tournamenturl 'motions-public-statistics' %}">{% trans "By round" %}</a>
        <a class="dropdown-item" href="{% tournamenturl 'motions-global-public-statistics' %}">{% trans "Globally" %}</a>
      </div>
    </li>
  {% else %}
    <li class="nav-item {% if motions_nav %}active{% endif %}">
      <a class="nav-link" href="{% tournamenturl 'motions-public-statistics' %}">{% trans "Motions Tab" %}</a>
    </li>
  {% endif %}
{% endif%}

<!-- DRAW RELEASES -->
{% if pref.public_draw == 'all-released' and not pref.team_tab_released %}
  <li class="nav-item dropdown {% if draw_nav %}active{% endif %}">
    <a class="nav-link dropdown-toggle" href="#" id="drawsDrop"
       data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
      {% trans "Draws" %}
    </a>
    <div class="dropdown-menu draw-dropdown-menu" aria-labelledby="drawsDrop">
      {% for r in tournament.round_set.all %}
        {% if r.draw_status == r.STATUS_RELEASED %}
          <a class="dropdown-item" href="{% roundurl 'draw-public-for-round' r %}">
            {{ r.name }}
          </a>
        {% endif %}
      {% endfor %}
      <div class="dropdown-item">
        {% trans "No Draws Available" %}
      </div>
    </div>
  </li>
{% elif pref.public_draw == 'current' and tournament.public_draws_available and not pref.team_tab_released %}
  <li class="nav-item {% if draw_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'draw-public-current-rounds' %}">
      {% if tournament.current_rounds|length == 1 %}
        {% blocktrans trimmed with round=current_round.name %}
          Draw for {{ round }}
        {% endblocktrans %}
      {% else %}
        {% trans "Current Draws" %}
      {% endif %}
    </a>
  </li>
{% endif %}

<!-- CHECK INS -->
{% if pref.public_checkins  %}
  <li class="nav-item {% if checkins_status %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'checkins-public-status' %}">
      {% trans "Check-Ins" %}
    </a>
  </li>
{% endif %}

<!-- RESULTS RELEASES -->
{% if pref.public_results and tournament.rounds_with_released_results %}
  <li class="nav-item dropdown {% if results_nav %}active{% endif %}">
    <a class="nav-link dropdown-toggle" href="#" id="roundsDrop"
       data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
       {% trans "Results" %}
    </a>
    <div class="dropdown-menu" aria-labelledby="roundsDrop">
      {% for r in tournament.rounds_with_released_results %}
        <a class="dropdown-item" href="{% roundurl 'results-public-round' r %}">
          {{ r.name }}
        </a>
      {% endfor %}
    </div>
  </li>
{% endif %}

<!-- BREAK RELEASES -->
{% if pref.public_breaking_teams or pref.public_breaking_adjs %}

  <li class="nav-item dropdown {% if break_nav %}active{% endif %}">
    <a class="nav-link dropdown-toggle" href="#" id="breakdrop"
       data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
      {% trans "Break" %}
    </a>
    <div class="dropdown-menu" aria-labelledby="breakdrop">
      {% if pref.public_breaking_teams %}
        {% for category in tournament.breakcategory_set.all %}
          <a class="dropdown-item" href="{% tournamenturl 'breakqual-public-teams' category.slug %}">
            {{ category.name }}
          </a>
        {% endfor %}
      {% endif %}
      {% if pref.public_breaking_adjs %}
        <a class="dropdown-item" href="{% tournamenturl 'breakqual-public-adjs' %}">
          {% trans "Adjudicators" %}
        </a>
      {% endif %}
    </div>
  </li>
{% endif %}

<!-- MISC -->
{% if pref.public_motions and pref.motion_tab_released == False %}
  <li class="nav-item {% if motions_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'motions-public' %}">{% trans "Motions" %}</a>
  </li>
{% endif %}
{% if pref.public_side_allocations %}
  <li class="nav-item {% if sides_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'draw-public-side-allocations' %}">{% trans "Sides" %}</a>
  </li>
{% endif %}
{% if pref.public_team_standings and current_round.prev and not pref.team_tab_released %}
  <li>
    <a class="nav-link" href="{% tournamenturl 'standings-public-teams-current' %}">{% trans "Standings" %}</a>
  </li>
{% endif %}
{% if pref.public_diversity %}
  <li class="nav-item {% if diversity_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'standings-public-diversity' %}">{% trans "Diversity" %}</a>
  </li>
{% endif %}
{% if pref.public_participants %}
  <li class="nav-item {% if participants_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'participants-public-list' %}">{% trans "Participants" %}</a>
  </li>
{% endif %}
{% if pref.public_institutions_list %}
  <li class="nav-item {% if institutions_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'participants-public-institutions-list' %}">{% trans "Institutions" %}</a>
  </li>
{% endif %}
{% if pref.feedback_progress %}
  <li class="nav-item {% if feedback_progress_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'public_feedback_progress' %}">{% trans "Feedback Progress" %}</a>
  </li>
{% endif %}
{% if pref.participant_ballots == 'public' %}
  {% if tournament.current_rounds|length == 1 %}
    <li class="nav-item {% if enter_ballots_nav %}active{% endif %}">
      <a class="nav-link" href="{% roundurl 'results-public-ballot-submission-index' tournament.current_rounds.0 %}">{% trans "Enter Ballot" %}</a>
    </li>
  {% elif tournament.current_rounds|length > 1 %}
    <li class="nav-item dropdown {% if enter_ballots_nav %}active{% endif %}">
      <a class="nav-link dropdown-toggle" href="#" id="roundsDrop"
         data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
         {% trans "Enter Ballot" %}
      </a>
      <div class="dropdown-menu" aria-labelledby="roundsDrop">
        {% for r in tournament.current_rounds %}
          <a class="dropdown-item" href="{% roundurl 'results-public-ballot-submission-index' r %}">
            {{ r.name }}
          </a>
        {% endfor %}
      </div>
    </li>
  {% endif %}
{% endif %}
{% if pref.participant_feedback == 'public' %}
  <li class="nav-item {% if enter_feedback_nav %}active{% endif %}">
    <a class="nav-link" href="{% tournamenturl 'adjfeedback-public-add-index' %}">{% trans "Enter Feedback" %}</a>
  </li>
{% endif %}
